package com.test4.service;

import com.test4.entity.Book;
import com.test4.mapper.BookMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService {
    @Resource
    private BookMapper bookMapper;
    public List<Book> findAllBooks() {
        return bookMapper.findAllBooks();
    }

    public Book findBookById(int id) {
        Book bookById = bookMapper.findBookById(id);
        return bookById;
    }

    public void addBook(Book book) {
        bookMapper.addBook(book);
    }

    public void deleteBook(int id) {
        bookMapper.deleteBook(id);
    }

    public void updateBook(Book book) {
        bookMapper.updateBook(book);
    }
}
